package com.runen.infinitemovement.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.runen.infinitemovement.R;
import com.runen.infinitemovement.model.entity.NewsEntity;
import com.runen.infinitemovement.tool.GlideUtils;
import com.runen.infinitemovement.widget.imageview.RoundedCornersImage;

/**
 * Create by LiaoDuanHong
 * Create on
 */
public class NewsHeaderAdapter extends BaseQuickAdapter<NewsEntity.DataBean.PeopleListBean, BaseViewHolder> {
    private Context context;

    public NewsHeaderAdapter(Context context) {
        super(R.layout.item_news_header);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, NewsEntity.DataBean.PeopleListBean peopleListBean) {
        RoundedCornersImage image = baseViewHolder.findView(R.id.rci_cover);
        TextView tvName = baseViewHolder.findView(R.id.tv_name);

        if (!TextUtils.isEmpty(peopleListBean.cover)) {
            GlideUtils.loadImage(context, peopleListBean.cover, image);
        }
        tvName.setText(peopleListBean.title);
    }
}
